草庐IT

c++ - GCC、Unicode 和 __FUNCTION__

全部标签

php - 通知 : Undefined index: HTTP_X_FORWARDED_FOR Error in Function

我收到通知:未定义索引:以下函数中的HTTP_X_FORWARDED_FOR:function_ip(){return(preg_match("/^([d]{1,3}).([d]{1,3}).([d]{1,3}).([d]{1,3})$/",$_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']);} 最佳答案 您应该使用getenv()方法而不是$_SERVER。function_ip(){if(preg_

php - 将 unicode 转换为 html 实体十六进制

如何将Unicode字符串转换为HTML实体?(HEX不是十进制)例如,将Français转换为Français。 最佳答案 对于relatedquestion中缺少的十六进制编码:$output=preg_replace_callback('/[\x{80}-\x{10FFFF}]/u',function($match){list($utf8)=$match;$binary=mb_convert_encoding($utf8,'UTF-32BE','UTF-8');$entity=vsprintf('&#x%X;',unpack(

PHP "Warning: usort() [function.usort]: Invalid comparison function"排序

我有以下数据作为关联数组array'abc'=>array'label'=>string'abc'(length=3)'weight'=>float3'wsx'=>array'label'=>string'wsx'(length=3)'weight'=>float1'qay'=>array'label'=>string'qay'(length=3)'weight'=>float1'http://test.com'=>array'label'=>string'http://test.com'(length=15)'weight'=>float0'Nasi1'=>array'label'=

php - php中的unicode preg_replace问题

我得到了字符串$result="beieinerTemperatur,dieetwa20bis60°CunterhalbdesSchmelzpunktesderkristallinenModifikation"直接来自MySQL表。表格和phpheader都设置为UTF-8我想去除“学位”符号:http://en.wikipedia.org/wiki/Degree_symbol并将其替换为“度”一词以获得:“beieinerTemperatur,dieetwa20bis60degreesCunterhalbdesSchmelzpunktesderkristallinenModifika

php - fatal error : Call to undefined function easter_date()

我正在尝试获取今年的easter_date。这是我的代码:当我执行代码时出现以下错误:fatalerror:在中调用未定义的函数easter_date()我的php版本是5.3.3。我正在使用Linux(Ubuntu)。您知道缺少什么吗? 最佳答案 如果您使用基于php:7.1的Dockerfile,您可以轻松安装calendar扩展:RUNdocker-php-ext-installcalendar&&docker-php-ext-configurecalendar 关于php-fat

php - CURL:不获取带有 unicode 字符的 url

我正在使用CURL获取Yahoo!带有unicode查询的BOSSapiurl,但我收到“错误请求”错误。http://boss.yahooapis.com/ysearch/web/v1/கமல்ஹாசன்?appid={appid}&format=xml上面的url工作正常并在firefox中返回结果。谁能帮我解决这个问题。$url="http://boss.yahooapis.com/ysearch/web/v1/கமல்ஹாசன்?appid={appid}&format=xml";$ch-curl_init($url);curl_setopt($ch,CURLOPT_HEADE

php - 具有 unicode 名称的文件夹中的 Apache htdocs

我的apache(适用于windows)htdocs位于c:\anything1\忧郁怒\anything2之类的文件夹中。问题是在这种情况下php不会从这里执行任何脚本,并且会显示如下错误消息:`警告:未知:无法打开流:第0行的未知中没有这样的文件或目录fatalerror:未知:第0行未知中的“c:/anything1/忧郁怒/anything2/index.php”(include_path='.;C:\php5\pear')打开失败`如果我尝试打开一个html文件,它是由apache提供的,所以问题似乎只出现在php上。您知道如何解决这个问题吗? 最

php - 什么时候使用 PHP strtolower() 函数是安全的?

PHPstrtolower()函数应该将字符串转换为小写。但是,它说inthePHPManual(强调):Returnsstringwithallalphabeticcharactersconvertedtolowercase.Notethat'alphabetic'isdeterminedbythecurrentlocale.Thismeansthatini.e.thedefault"C"locale,characterssuchasumlaut-A(Ä)willnotbeconverted.手册在这里没有提及编码,但众所周知strtolower()会损坏UTF-8字符串,您应该使用

PHP 问题 : password_hash function is not able to generate a salt

我正在创建一个用户注册服务提供商,我正在使用password_hash函数来散列提供的用户密码。以下是用于创建散列字符串的代码部分:publicfunctiongenerateHash($string){returnpassword_hash($string,PASSWORD_BCRYPT);}正如我从PHP手册中了解到的那样,我们不应该生成我们的盐,而是让password_hash函数来处理它以提高安全性。但是,当我尝试创建新用户时,我收到以下警告:Warning:password_hash():Unabletogeneratesalt应用程序创建了用户,但由于上述问题,不会生成哈希

php - preg_match() [function.preg-match] : Unknown modifier

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭10年前。我收到此错误消息:preg_match()[function.preg-match]:Unknownmodifier'='in/home/public_html/checkem.phponline13当我转到以下行时,我得到了这个:我已将ereg更改为preg_match然后用//包装代码,因为ereg出现了作为弃用。我仍然是编码的初学者,非常感谢任何帮助。